//
//  SWMessageVisitorView.swift
//  SinaWeibo
//
//  Created by wszyxc on 16/7/19.
//  Copyright © 2016年 wszyxc. All rights reserved.
//

import UIKit

class SWMessageVisitorView: UIView {


    override init(frame: CGRect) {
    
        super.init(frame: frame)
        
        //设置控件
        setupUI()
        
        //设置约束
        setupLayout()
        
        backgroundColor = UIColor(colorLiteralRed: 237/255, green: 237/255, blue: 237/255, alpha: 1)
   
    
    }

   required init?(coder aDecoder: NSCoder) {
       fatalError("init(coder:) has not been implemented")
   }
    
    
    func setupUI(){
        
        addSubview(iconImageView)
        
        addSubview(introLabel)
        
        addSubview(registerBtn)
        
        addSubview(loginBtn)
    }
    
    func setupLayout(){
        
        iconImageView.snp_makeConstraints { (make) -> Void in
            
            make.width.height.equalTo(100)
            make.centerX.equalTo(self.snp_centerX)
            make.top.equalTo(150)
        }
        
        introLabel.snp_makeConstraints { (make) -> Void in
            
            make.centerX.equalTo(self.snp_centerX)
            make.width.equalTo(ScreenWidth - 100)
            make.top.equalTo(iconImageView.snp_bottom).offset(30)
            
        }
        
        registerBtn.snp_makeConstraints { (make) -> Void in
            
            make.top.equalTo(introLabel.snp_bottom).offset(20)
            make.centerX.equalTo(self.snp_centerX).offset(-60)
            make.width.equalTo(100)
            make.height.equalTo(35)
            
        }
        
        loginBtn.snp_makeConstraints { (make) -> Void in
            
            make.top.equalTo(introLabel.snp_bottom).offset(20)
            make.centerX.equalTo(self.snp_centerX).offset(60)
            make.width.equalTo(100)
            make.height.equalTo(35)
            
        }
        
        
    }
    
    
    /**
    *  懒加载控件
    */
    
    private var iconImageView:UIImageView = {
        
        let imageView:UIImageView = UIImageView(image: UIImage(named: "visitordiscover_image_message"))

        
        return imageView
    }()
    
    private var introLabel:UILabel = {
        
        let label:UILabel = UILabel(textColor: UIColor.lightGrayColor(), fontSize: 15)
        
        label.text = "登陆后,别人评论你的微博,给你发消息,都会在这里收到通知"
        
        label.numberOfLines = 0
        
        label.textAlignment = .Center
        
        return label
        
    }()
    
    private var registerBtn:UIButton = {
       
        let btn:UIButton = UIButton(textColor: UIColor.orangeColor(), fontSize: 17)
        
//        let strechImage:UIImage = (UIImage(named: "common_button_white")?.resizableImageWithCapInsets(UIEdgeInsetsMake(30, 10, 30, 10), resizingMode: UIImageResizingMode.Stretch))!
        
        let oImage:UIImage = UIImage(named: "common_button_white")!
        
        btn.setBackgroundImage(oImage, forState: .Normal)
        
        btn.setTitle("注册", forState: .Normal)
        
        btn.layer.cornerRadius = 5
        
        return btn
    }()
    
    private var loginBtn:UIButton = {
        
        let btn:UIButton = UIButton(textColor: UIColor.lightGrayColor(), fontSize: 17)
        
        btn.setBackgroundImage(UIImage(named: "common_button_white"), forState: .Normal)
        
        btn.setTitle("登陆", forState: .Normal)
        
        btn.layer.cornerRadius = 5
        
        return btn
    }()
    

}
